package com.jokerku.lottery.domain.receive;

import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.jokerku.lottery.application.IWxReceiveService;
import com.jokerku.lottery.domain.receive.engine.Engine;
import com.jokerku.lottery.domain.receive.model.BehaviorMatter;
import com.jokerku.lottery.domain.receive.model.MessageTextEntity;
import com.jokerku.lottery.infrastructure.utils.XmlUtil;
import com.jokerku.lottery.interfaces.WxPortalController;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;

/**
 * @Author: guzq
 * @CreateTime: 2022/08/30 16:56
 * @Description: 微信消息处理
 * @Version: 1.0
 */
@Service
public class WxReceiveServiceImpl implements IWxReceiveService {

    private final Logger log = LoggerFactory.getLogger(WxPortalController.class);

    @Resource
    private Engine msgEngineHandle;

    @Override
    public String doReceive(BehaviorMatter request) {
        log.info("消息入参：{}",JSON.toJSONString(request));
        return msgEngineHandle.process(request);
    }
}
